﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="NhanVien.aspx.cs" Inherits="LotteCinema.Admin.NhanVien" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Import Namespace="LotteCinema.DTO" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="title" style="font-size:14pt;">QUẢN LÝ NHÂN VIÊN</div>
    
    <asp:panel ID="pnNhanVien" Width="100%" runat="server">
      <table id="table1" 
            style=" border-collapse:collapse; background-color:#D0DEF0; width:100%;" >
        <tr>
            <td style="width:50px;">
                <asp:Button ID="btnThemMoi"  onclick="btnThemMoi_Click" runat="server" Font-Bold="true" CssClass="btnthem" Text="THÊM MỚI" Width="120px" />
            </td>
        </tr>
        <tr>
            <td align="center">
                <asp:Label ID="Label10" runat="server" Font-Bold="true" CssClass="txtbox" Font-Size="14px" Text="Tìm Kiếm Nhân Viên"></asp:Label>
                &nbsp&nbsp&nbsp 
                <asp:TextBox ID="txtSearch" runat="server"> </asp:TextBox>
                <asp:AutoCompleteExtender ID="txtSearch_Auto" runat="server" DelimiterCharacters="" Enabled="True" ServiceMethod="GetKeyWords" MinimumPrefixLength="1" TargetControlID="txtSearch" UseContextKey="True">
                </asp:AutoCompleteExtender>
                <asp:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" runat="server" TargetControlID="txtSearch" Enabled="true" WatermarkText="Nhập từ khóa">
                </asp:TextBoxWatermarkExtender>
                &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp 
                <asp:Button ID="bttimkiem" runat="server" Text="Tìm Kiếm" 
                    onclick="bttimkiem_Click" />
            </td>
        </tr>
        <tr>
        <td style="height:20px">
        </td>
            <tr>
                <td>
                    <asp:DataGrid ID="grdNhanVien" runat="server" AllowPaging="True" 
                        AutoGenerateColumns="False" BackColor="White" BorderColor="#CCCCCC" 
                        BorderStyle="None" BorderWidth="1px" CellPadding="3" Font-Bold="False" 
                        Font-Italic="False" Font-Overline="False" Font-Strikeout="False" 
                        Font-Underline="False" OnItemCommand="grdNhanVien_ItemCommand" 
                        OnPageIndexChanged="grdNhanVien_PhanTrang" Width="100%">
                        <HeaderStyle BackColor="#507CD1" Font-Bold="true" ForeColor="White" />
                        <Columns>
                            <asp:BoundColumn DataField="manv" HeaderText="Mã Nhân Viên">
                                <HeaderStyle Width="80px" />
                            </asp:BoundColumn>
                            <asp:BoundColumn DataField="matkhau" HeaderText="Mật Khẩu">
                                <HeaderStyle Width="60px" />
                            </asp:BoundColumn>
                            <asp:BoundColumn DataField="hoten" HeaderText="Họ Tên">
                                <HeaderStyle Width="150px" />
                            </asp:BoundColumn>
                            <asp:BoundColumn DataField="cmnd" HeaderText="CMND">
                                <HeaderStyle Width="50px" />
                            </asp:BoundColumn>
                            <asp:BoundColumn DataField="ngaysinh" DataFormatString="{0:d}" 
                                HeaderText="Ngày Sinh">
                                <HeaderStyle Width="70px" />
                            </asp:BoundColumn>
                            <asp:BoundColumn DataField="gioitinh" FooterStyle-HorizontalAlign="Center" 
                                HeaderText="Giới Tính">
                                <FooterStyle HorizontalAlign="Center" />
                                <HeaderStyle Width="50px" />
                            </asp:BoundColumn>
                            <asp:BoundColumn DataField="diachi" HeaderText="Địa Chỉ"></asp:BoundColumn>
                            <asp:BoundColumn DataField="dienthoai" HeaderText="Điện Thoại">
                                <HeaderStyle Width="70px" />
                            </asp:BoundColumn>
                            <asp:BoundColumn DataField="macv" HeaderText="Mã Chức Vụ" Visible="false">
                                <HeaderStyle Width="30px" />
                            </asp:BoundColumn>
                            <asp:BoundColumn DataField="tencv" HeaderText="Tên Chức Vụ">
                                <HeaderStyle Width="150px" />
                            </asp:BoundColumn>
                            <asp:TemplateColumn>
                                <HeaderTemplate>
                                    Sữa/Xóa
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <asp:LinkButton ID="lbtSua" runat="server" 
                                        CommandArgument='<%#DataBinder.Eval(Container.DataItem,"manv")%>' 
                                        CommandName="Edit" CssClass="edit" 
                                        OnClientClick="return confirm(&quot;Bạn có muốn sữa không ?&quot;)" 
                                        ToolTip="Sửa" />
                                    |
                                    <asp:LinkButton ID="lbtXoa" runat="server" 
                                        CommandArgument='<%#DataBinder.Eval(Container.DataItem,"manv")%>' 
                                        CommandName="Delete" CssClass="delete" 
                                        OnClientClick="return confirm(&quot;Bạn có chắc chắn muốn xóa không ?&quot;)" 
                                        ToolTip="Xóa" />
                                </ItemTemplate>
                            </asp:TemplateColumn>
                        </Columns>
                        <FooterStyle BackColor="White" ForeColor="#000066" />
                        <HeaderStyle BackColor="#ff6600" CssClass="trHeder" />
                        <ItemStyle ForeColor="#000066" />
                        <PagerStyle BackColor="White" Font-Size="16px" ForeColor="#000066" 
                            HorizontalAlign="Center" Mode="NumericPages" />
                        <SelectedItemStyle BackColor="#669999" Font-Bold="true" ForeColor="White" />
                    </asp:DataGrid>
                </td>
            </tr>
        </tr>
    </table>
    </asp:panel>
    <%if (Session["chucnang"] != null)
      { %>
<asp:Panel ID="pnThem" runat="server" HorizontalAlign="Left">
        <table id="table2" style="border-collapse:collapse" cellpadding="0" width="100%" border="0" >
            <tr>
                    <td width="350" />
                    <td width="150" class="name_fild_row">
                        <asp:Label ID="Label7" Text="Mã Nhân Viên" runat="server" />
                     <div>&nbsp;</div>
                    </td>
                    <td>
                             <asp:TextBox ID="txtmanhanvien" runat="server" ></asp:TextBox>
                                  <asp:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender2"
                                      runat="server" TargetControlID="txtmanhanvien" 
                                    WatermarkText="Nhập mã nhân viên">
                                  </asp:TextBoxWatermarkExtender>
                             <asp:RequiredFieldValidator ID="rfvtxtmanhanvien" runat="server" 
                                 ControlToValidate="txtmanhanvien" ErrorMessage="Mã nhân viên không được bỏ trống" 
                                 ForeColor="Red" SetFocusOnError="True">(*)</asp:RequiredFieldValidator>
                         <div>
                             &nbsp;
                         </div>
                    </td>
                </tr>
            <tr>
                <td width="350" />
                <td width="150" class="name_fild_row">
                    <asp:Label ID="Label1" Text="Mật Khẩu" runat="server" />
                    <div>&nbsp;</div>
                </td>
                <td>
                    <asp:TextBox ID="txtmatkhau" runat="server" TextMode="Password"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="rfvtxtmatkhau" runat="server" 
                        ControlToValidate="txtmatkhau" ErrorMessage="Mật khẩu không được bỏ trống" 
                        ForeColor="Red" SetFocusOnError="True">(*)</asp:RequiredFieldValidator>
                    <div >
                        &nbsp;
                    </div>
                </td> 
                               
            </tr>  
            <tr>
                <td width="350" />
                <td width="150" class="name_fild_row">
                    <asp:Label ID="Label5" Text="Xác Nhận Mật Khẩu" runat="server" />
                    <div>&nbsp;</div>
                </td>
                <td>
                    <asp:TextBox ID="txtxacnhanmatkhau" runat="server" TextMode="Password" />
                    <asp:RequiredFieldValidator ID="rfvtxtxacnhanmatkhau" runat="server" 
                        ControlToValidate="txtxacnhanmatkhau" ErrorMessage="Mật khẩu không được bỏ trống" 
                        ForeColor="Red" SetFocusOnError="True">(*)</asp:RequiredFieldValidator>
                    <asp:CompareValidator ID="cvtxtxacnhanmatkhau" runat="server" 
                        ControlToCompare="txtmatkhau" ControlToValidate="txtxacnhanmatkhau" 
                        CultureInvariantValues="True" ErrorMessage="Mật khẩu không trùng khớp" 
                        ForeColor="Red" SetFocusOnError="True">(*)</asp:CompareValidator>
                    <div >
                        &nbsp;
                    </div>
                </td> 
                               
            </tr>  
               <tr>
                    <td width="350" />
                    <td width="150" class="name_fild_row">
                        <asp:Label ID="Label4" Text="Họ Tên" runat="server" />
                     <div>&nbsp;</div>
                    </td>
                    <td>
                             <asp:TextBox ID="txthoten" runat="server" />
                             <asp:RequiredFieldValidator ID="rfvtxthoten" runat="server" 
                                 ControlToValidate="txthoten" ErrorMessage="Họ tên không được bỏ trống" 
                                 ForeColor="Red" SetFocusOnError="True">(*)</asp:RequiredFieldValidator>
                         <div>
                             &nbsp;
                         </div>
                    </td>
                </tr> 
                   <tr>
                    <td width="350" />
                    <td width="150" class="name_fild_row">
                        <asp:Label ID="Label6" Text="CMND" runat="server" />
                     <div>&nbsp;</div>
                    </td>
                    <td>
                             <asp:TextBox ID="txtcmnd" runat="server" />
                             <asp:RequiredFieldValidator ID="rfvtxtcmnd" runat="server" 
                                 ControlToValidate="txtcmnd" ErrorMessage="CMND không được bỏ trống" 
                                 ForeColor="Red" SetFocusOnError="True">(*)</asp:RequiredFieldValidator>
                         <div>
                             &nbsp;
                         </div>
                    </td>
                </tr>  
                 <tr>
                    <td width="350" />
                    <td class="name_fild_row" width="150">
                        <asp:Label ID="Label11" runat="server" Text="Ngày Sinh" />
                        <div>
                            &nbsp;</div>
                    </td>
                    <td>
                        <asp:TextBox ID="txtngaysinh" runat="server"></asp:TextBox>
                        <asp:CalendarExtender ID="CalendarExtender2" DefaultView="Years" runat="server" Enabled="true" TargetControlID="txtngaysinh" Format="dd/MM/yyyy">
                        </asp:CalendarExtender>
                        <asp:RequiredFieldValidator ID="rfvtxtngaysinh" runat="server" 
                            ControlToValidate="txtngaysinh" 
                            ErrorMessage="Ngày sinh không được bỏ trống" ForeColor="Red" 
                            SetFocusOnError="True">(*)</asp:RequiredFieldValidator>
                        <div>
                            &nbsp;
                        </div>
                    </td>
                </tr>       
            <tr>
                <td width="350" />
                <td width="150" class="name_fild_row">
                    <asp:Label ID="lblgioitinh" Text="Giới Tính" runat="server" />
                    <div>&nbsp;</div>
                </td>
                <td>
                    <asp:DropDownList ID="ddlgioitinh" runat="server">
                    </asp:DropDownList>
                    <div>
                        &nbsp;
                    </div>
                </td>
            </tr>
            <caption>
                <asp:ValidationSummary ID="ValidationSummary1" runat="server" ForeColor="Red" />
                <tr>
                    <td width="350" />
                    <td width="150" class="name_fild_row">
                        <asp:Label ID="Label8" Text="Địa Chỉ" runat="server" />
                     <div>&nbsp;</div>
                    </td>
                    <td>
                             <asp:TextBox ID="txtdiachi" runat="server" />
                             <asp:RequiredFieldValidator ID="rfvtxtdiachi" runat="server" 
                                 ControlToValidate="txtdiachi" ErrorMessage="Địa chỉ không được bỏ trống" 
                                 ForeColor="Red" SetFocusOnError="True">(*)</asp:RequiredFieldValidator>
                         <div>
                             &nbsp;
                         </div>
                    </td>
                </tr>
                <tr>
                    <td width="350" />
                    <td class="name_fild_row" width="150">
                        <asp:Label ID="Label2" runat="server" Text="Điện Thoại" />
                        <div>
                            &nbsp;</div>
                    </td>
                    <td>
                        <asp:TextBox ID="txtdienthoai" runat="server" />
                        <asp:RequiredFieldValidator ID="rfvtxtdienthoai" runat="server" 
                        ControlToValidate="txtdienthoai" ErrorMessage="Điện thoại không được bỏ trống" 
                        ForeColor="Red" SetFocusOnError="True" Display="Dynamic" type="Integer">(*)</asp:RequiredFieldValidator>
                        <asp:RegularExpressionValidator ID="revtxtdienthoai" runat="server" 
                            ControlToValidate="txtdienthoai" ErrorMessage="Số điện thoại không hợp lệ" 
                            ForeColor="Red" SetFocusOnError="True" 
                            
                            ValidationExpression="[0-9][1-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]|[0-9][1-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" 
                            ValidationGroup="ktnhanvien">(*)</asp:RegularExpressionValidator>
                        <div>
                            &nbsp;
                        </div>
                    </td>
                </tr>
                <tr>
                    <td width="350" />
                    <td class="name_fild_row" width="150">
                        <asp:Label ID="Label9" runat="server" Text="Chức Vụ" />
                        <div>
                            &nbsp;</div>
                    </td>
                    <td>
                        <asp:DropDownList ID="ddlchucvu" runat="server">
                        </asp:DropDownList>
                        <div>
                            &nbsp;
                        </div>
                    </td>
                </tr>
        
                <tr>
                    <td width="350" />
                    <td class="name_fild_row" width="150">
                    </td>
                    <td>
                    <%--OnClick="lbtThem_Click"--%>
                    <%if (Session["chucnang"] == "them")
                      { %>
                        <asp:LinkButton ID="lbtThem" runat="server" CssClass="btnthem" Font-Size="14px" 
                            onclick="lbtThem_Click" ><b>THÊM</b></asp:LinkButton>
                            <%}
                      else if (Session["chucnang"] == "capnhat")
                      { %>
                            <!--button cap nhat-->
                            <%} %>
                        &nbsp&nbsp&nbsp&nbsp
                             <%--onclick="lblQuayLai_Click"--%>
                        <asp:LinkButton ID="lblQuayLai" runat="server" CssClass="back" 
                            Font-Size="14px" onclick="lblQuayLai_Click" CausesValidation="False" ><b>QUAY LẠI</b></asp:LinkButton>
                    </td>
                </tr>
            </caption>
      </table>
    </asp:Panel>
    <%} %>
    <asp:Panel ID="pnCapNhat" runat="server">
    <table style="border-collapse:collapse" cellpadding="0" width="100%" border="0">
        <tr>
                    <td width="350" />
                    <td class="name_fild_row" width="150">
                        <asp:Label ID="Label3" runat="server" Text="Chức Vụ" />
                        <div>
                            &nbsp;</div>
                    </td>
                    <td>
                        <asp:DropDownList ID="ddlCapNhatChucVu" runat="server">
                        </asp:DropDownList>
                        <div>
                            &nbsp;
                        </div>
                    </td>
                </tr>
        
                <tr>
                    <td width="350" />
                    <td class="name_fild_row" width="150">
                    </td>
                    <td>
                     <%--   onclick="lbtCapNhat_Click"--%>
                        <asp:LinkButton ID="lblCapNhatChucVu" runat="server" CssClass="update" 
                             Font-Size="14px" onclick="lblCapNhatChucVu_Click"><b>CẬP NHẬT</b></asp:LinkButton>
                            &nbsp&nbsp&nbsp&nbsp
                             <%--onclick="lblQuayLai_Click"--%>
                        <asp:LinkButton ID="lblQuayLai2" runat="server" CssClass="back" 
                            Font-Size="14px" onclick="lblQuayLai2_Click" 
                            PostBackUrl="~/Admin/NhanVien.aspx" CausesValidation="False"><b>QUAY LẠI</b></asp:LinkButton>
                    </td>
                </tr>
       </table>
    </asp:Panel>
</asp:Content>
